/*
 * 
 *
 * Authors: Soeren Gebbert, soeren.gebbert@vti.bund.de
 *          Axel Don, axel.don@vti.bund.de
 *
 * Copyright:
 *
 * Johann Heinrich von Thünen-Institut
 * Institut für Agrarrelevante Klimaforschung
 *
 * Phone: +49 (0)531 596 2601
 *
 * Fax:+49 (0)531 596 2699
 *
 * Mail: ak@vti.bund.de
 *
 * Bundesallee 50
 * 38116 Braunschweig
 * Germany
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef EVENT_BASE_H
#define EVENT_BASE_H

#include <vector>
#include <iostream>
#include <string>
#include <fstream>

class initial_parameters;
class runtime_parameters;
class micr_cluster;
class carb_particle;

/* Base class for events */
class event_base {
public:
    event_base();  
    /**
     * @descr Set the event parameter file name
     * @param filename
     */
    virtual void set_file_name(std::string filename){this->filename = filename;};
    /**
     * @descr  Return the parameter file name
     * @return 
     */
    virtual std::string get_file_name(){return this->filename;};
    
    /**
     * Read the parameter from the parameter file
     * @return 
     */
    virtual bool read_parameter() = 0;
    /**
     * 
     * @descr Check the timestep and modify the particles event specific
     * @param timestep
     * @param init_params
     * @param run_params
     * @param mc
     * @param cb
     * @return 
     */
    virtual bool modify_particles(unsigned int timestep, initial_parameters *init_params, 
                                  runtime_parameters *run_params,
                                  std::vector<micr_cluster*> &mc, 
                                  std::vector<carb_particle*> &cp) = 0;
protected:
    std::string filename; // The parameter file name
    unsigned int start; // The start time step of this event
    unsigned int stop;  // The stop time step of this event
    unsigned int frequence; // At which frequency does this event occure
    unsigned int count; // Internal occurence counter 
    
    /**
     * Read the start, end and frequence from the provided input file stream
     * @param in The input file stream
     * @return True if success
     */
    virtual bool read_base_parameter(std::ifstream &input);
};
#endif
